body{
    font-family: 'Roboto',sans-serif;
}

*{
    padding: 0;
    margin: 0;
    list-style: none;
    text-decoration: none;
}

.sidebar{
    position: fixed;
    left: -250px;
    width: 250px;
    height: 100%;
    background: #27285e;
    transition: all .5s ease;
}

.sidebar header{
    line-height: 70px;
    font-size: 22px;
    color: white;
    text-align: center;
    background: #4849aa;
    /* 用户无法选择文本 */
    user-select: none;
}
.sidebar ul a{
    display: block;
    height: 100%;
    width: 100%;
    line-height: 60px;
    color: white;
    font-size: 20px;
    padding-left: 40px;
    box-sizing: border-box;
    border-top: 2px solid rgba(255, 255, 255, 0.103);
    border-bottom: 1px solid black;
    transition: .4s;
}
ul li:hover a{
    padding-left: 50px;
}

.sidebar ul a i{
    margin-right: 16px;
}

/* 显示和隐藏开关 */
#check{
    display: none;
}
label #btn,label #cancel{
    position: absolute;
    cursor: pointer;
    background: #000000;
}
label #btn{
    left: 20px;
    top: 20px;
    font-size: 35px;
    color: rgb(255, 255, 255);
    padding: 6px 10px;
    border-radius: 10px;
    transition: .4s;
}
label #cancel{
    z-index: 111;
    left: -195px;
    top: 17px;
    font-size: 30px;
    color: white;
    padding: 4px 9px;
    background: #4849aa;
    transition: .4s;
}

#check:checked ~ .sidebar{
    left: 0;
}
#check:checked ~ label #btn{
    left: 250px;
    opacity: 0;
    pointer-events: none;
}
#check:checked ~ label #cancel{
    left: 195px;  
}


/* 插入并设置图片格式 */
section{
    background: url(img/bg.jpg) no-repeat;
    background-position: center;
    background-size: cover;
    height: 100vh;
    /* 设置切换动画 */
    transition: all .5s;
}

#check:checked ~ section{
    margin-left: 250px; 
}